<?php

abstract class Conexion {

    private static $pServer = "localhost";
    private static $pUser = "root";
    private static $pPassword = "";
    private static $pPort = "3306";
    protected $pDatabase;
    private $miConexion;
    /*hola roynaldo*/
    function __construct() {
        $this->miConexion = new mysqli($this->pServer, $this->pUser, $this->pPassword, $this->pDatabase, $this->pPort);
    }

    function Escapar_Caracteres($vCadena) {
        return mysqli_real_escape_string($this->miConexion, $vCadena);
    }

    function Ejecutar_Consulta($strQuery) {
        $rs = $this->miConexion->query($strQuery);
        if ($rs)
            return $rs;
        else
            return false;
    }

    function Ultimo_Codigo_Generado() {
        $rs = $this->miConexion->query("select last_insert_id() as codigo");
        if ($rs) {
            $row = $rs->fetch_array();
            return intval($row['codigo']);
        }else
            return 0;
    }

    function Ejecutar_SQL($strQuery) {
    //print_r($this->miConexion);
        $rptaS = $this->miConexion->query($strQuery);
        return $rptaS;
    }

    function __destruct() {
        $this->miConexion->close();
    }
    function hola(){
        //hola
    }

}
?>